// 认证相关的getters
export default {
  // 获取token
  token: state => state.token,
  
  // 获取用户信息
  user: state => state.user,
  
  // 获取用户角色
  roles: state => state.roles,
  
  // 获取用户权限
  permissions: state => state.permissions,
  
  // 检查用户是否已认证
  isAuthenticated: state => state.isAuthenticated,
  
  // 检查登录加载状态
  loginLoading: state => state.loginLoading,
  
  // 检查注册加载状态
  registerLoading: state => state.registerLoading,
  
  // 检查用户是否有指定角色
  hasRole: state => role => state.roles.includes(role),
  
  // 检查用户是否有指定权限
  hasPermission: state => permission => state.permissions.includes(permission),
  
  // 检查用户是否为管理员
  isAdmin: state => state.roles.includes('admin'),
  
  // 获取用户名
  username: state => state.user ? state.user.username : '',
  
  // 获取用户邮箱
  email: state => state.user ? state.user.email : ''
}